package com.sumer.psychology.sharing.application.query;

import com.sumer.psychology.common.query.AbstractSimpleQueryApplicationService;

/**
 * 资源分享查询服务
 * <p/>
 * User: zhenguang.zhu
 * Date: 2014/11/3
 * Time: 15:35
 */
public class SharedResourceQueryApplicationService extends AbstractSimpleQueryApplicationService {
    private static final String DB_NAME = "sumer_resource";

    @Override
    protected String dbName() {
        return DB_NAME;
    }

    /**
     * 关键字查询文章
     *
     * @param keyword      key word
     * @param countPerPage count per page
     * @param offset       off set
     * @return json
     */
    public String findByKeyword(String keyword, int countPerPage, int offset) {
        return super.findByKeyword(keyword, countPerPage, offset, "topic");
    }

    /**
     * 查询作者下的文章
     *
     * @param authorId     author id
     * @param countPerPage count per page
     * @param offset       off set
     * @param keyword      key word
     * @return json
     */
    public String findByAuthor(String authorId, int countPerPage, int offset, String keyword) {
        return super.findByAuthor(authorId, countPerPage, offset, keyword, "topic");
    }
}
